package com.aspose.cells;

import java.util.ArrayList;

public class ExternalLinkCollection {
   private WorksheetCollection a;
   private ArrayList b;
   private int c;

   WorksheetCollection a() {
      return this.a;
   }

   ExternalLinkCollection(WorksheetCollection sheets) {
      this.a = sheets;
      this.b = new ArrayList();
   }

   public int getCount() {
      return this.b.size();
   }

   public int add(String fileName, String[] sheetNames) {
      zbqg var3 = new zbqg();
      var3.a(fileName, sheetNames, 0);
      ExternalLink var4 = new ExternalLink(this);
      var4.a(var3);

      for(int var5 = 0; var5 < this.getCount(); ++var5) {
         zbqg var6 = this.get(var5).a();
         if (com.aspose.cells.b.a.zv.a(var6.k(), fileName, true) == 0) {
            this.b.set(var5, var4);
            return var5;
         }
      }

      this.a.v().a(var3);
      return com.aspose.cells.b.a.a.ze.a(this.b, (Object)var4);
   }

   public int add(int directoryType, String fileName, String[] sheetNames) {
      zbqg var4 = new zbqg();
      switch(directoryType) {
      case 1:
         var4.a(fileName, sheetNames, 2);
         break;
      case 2:
         var4.a(fileName, sheetNames, 3);
         break;
      case 3:
         var4.a(fileName, sheetNames, 4);
         break;
      default:
         var4.a(fileName, sheetNames, 0);
      }

      ExternalLink var5 = new ExternalLink(this);
      var5.a(var4);

      for(int var6 = 0; var6 < this.getCount(); ++var6) {
         zbqg var7 = this.get(var6).a();
         if (com.aspose.cells.b.a.zv.a(var7.k(), fileName, true) == 0) {
            this.b.set(var6, var5);
            return var6;
         }
      }

      this.a.v().a(var4);
      return com.aspose.cells.b.a.a.ze.a(this.b, (Object)var5);
   }

   int a(ExternalLink var1) {
      return com.aspose.cells.b.a.a.ze.a(this.b, (Object)var1);
   }

   public ExternalLink get(int index) {
      return (ExternalLink)this.b.get(index);
   }

   void a(zbqf var1) {
      if (var1 != null) {
         for(int var2 = 0; var2 < var1.getCount(); ++var2) {
            zbqg var3 = var1.a(var2);
            if (var3.e()) {
               this.c = var2;
            } else if (var3.h()) {
               ExternalLink var4 = new ExternalLink(this);
               var4.a(var3);
               this.a(var4);
            }
         }

      }
   }
}
